//
//  GXBatchManageController.m
//  YIChuSeller
//
//  Created by 田小椿 on 2018/11/30.
//  Copyright © 2018年 xiangshengjun. All rights reserved.
//

#import "GXBatchManageController.h"
@interface GXBatchManageController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView * manageTableView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@end
static NSString *const manageCell=@"ManageCell";
@implementation GXBatchManageController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"批量管理";
    self.view.backgroundColor = kGlobalbgColor;
    [self initTableView];
}
- (NSMutableArray *)dataArray
{
    if (!_dataArray) {
        NSString * filePath = [[NSBundle mainBundle]pathForResource:@"batchManageData" ofType:@"plist"];
        _dataArray =[[NSMutableArray alloc] initWithContentsOfFile:filePath];
    }
    return _dataArray;
}
-(void)initTableView{
    UITableView *homeTable=[[UITableView alloc] initWithFrame:CGRectMake(5,0,kUIScreenWidth-10,kUIScreenHeight) style:UITableViewStyleGrouped];
    homeTable.backgroundColor = kGlobalbgColor;
    homeTable.delegate=self;
    homeTable.dataSource=self;
    homeTable.sectionHeaderHeight = 20;
    homeTable.sectionFooterHeight = 0.01f;
    homeTable.showsHorizontalScrollIndicator=NO;
    homeTable.showsVerticalScrollIndicator=NO;
    homeTable.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
    self.manageTableView=homeTable;
    [self.view addSubview:homeTable];
    
}
- (void)setupTableFooterView
{
    UIView * footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kUIScreenWidth, 20)];
    footerView.backgroundColor = [UIColor clearColor];
    self.manageTableView.tableFooterView = footerView;
}

#pragma mark ---UITableViewDataSource UITableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArray.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:manageCell];
    if (!cell) {
        cell= [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:manageCell];
        NSDictionary * dict = self.dataArray[indexPath.row];
        cell.textLabel.text = dict[@"titleStr"];
        cell.textLabel.font = [UIFont systemFontOfSize:12];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.layer.masksToBounds = YES;
        cell.layer.cornerRadius = 2;
    }

    return cell;
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 40;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView * headerView = [[UIView alloc]init];
    headerView.backgroundColor = [UIColor clearColor];
    return headerView;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];//取消cell选中的效果
}

@end

